class Coordinate:
    x = 10
    y = -5
    z = 0


point1 = Coordinate()
point1.re = 34

print('x = ', point1.x)  # x =  10
print('y = ', point1.y)  # y =  -5
print('z = ', point1.z)  # z =  0

delattr(Coordinate, 'z')

print("删除z属性后")
# print('z = ', point1.z)  # AttributeError: 'Coordinate' object has no attribute 'z'


point2 = Coordinate()


# print('z = ', point2.z)  # AttributeError: 'Coordinate' object has no attribute 'z'


class A(object):
    bar = 1


a = A()

print(getattr(a, 'bar'))  # 1
setattr(a, 'bar', 5)
print(a.bar)  # 5
setattr(a, "age", 28)
print(a.age)  # 28
print(a.__dict__)  # {'bar': 5, 'age': 28}
